Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <ul id="myList"> <li id="myLI">Coffee</li> </ul> <p>Click one button to remove the li element from ul. Click the other button to insert the removed li element to ul.</p> <button onclick="removeLi()">Remove li</button> <button onclick="appendLi()">Insert li</button> <script> var item = document.getElementById("myLI"); function removeLi() { item.parentNode.removeChild(item); } function appendLi() { var list = document.getElementById("myList"); list.appendChild(item); } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_node_removechild4 by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:28:59 GMT --> </html>
Result:
Try it Yourself - © w3schools.com